import { get_list, get_car_list } from "../api/index";

export let getList = () => {
  return async (dispatch) => {
    let { data } = await get_list();
    dispatch({
      type: "GET_LIST",
      payload: data,
    });
  };
};

export let checkbox = (index) => {
  return {
    type: "CHEC_KBOX",
    payload: index,
  };
};

export let getCarList = () => {
  return async (dispatch) => {
    let { data } = await get_car_list();
    dispatch({
      type: "GET_CAR_LIST",
      payload: data,
    });
  };
};
// 加加
export let add = (index) => {
  return {
    type: "ADD",
    payload: index,
  };
};
// 减减
export let sub = (index) => {
  return {
    type: "SUB",
    payload: index,
  };
};
// 总价
export let zjqq = () => {
  return {
    type: "ZJQQ",
  }
}
// 加购物车
export let remove = (item) => {
  return {
    type: "REMOVE",
    payload: item,
  }
}

